
%% Unit conversion constants:

G2L     = 3.78541; % Liters/Gallon
lbs2kg  = 0.454; % kg/lbs
kmsq2ha = 100; % ha/kmsq
et_y = 86.3; % Ethanol yield - L/ton - (Macedo et al., 2008)
y    = 87.1; % sugarcane yield - ton/ha - (Macedo et al., 2008)

%% Policy settings:
dDUS_ethanol = 5*10^9; % US Sugarcane ethanol mandate in gallons
dDUS = dDUS_ethanol*G2L/et_y; % US Sugarcane ethanol mandate in tons of sugarcane

%% World market settings:
S_W = 1911179775; % World sugarcane output (in tonnes) - FAOSTAT 2013
S_BR  = 768090444; % Brazilian sugarcane output (in tonnes) - FAOSTAT 2013
S_ROW = S_W - S_BR;

DeBR_etanol = 27476; % Brazilian ethanol demand in thousands of m^3;
DeBR = DeBR_etanol*(10^6)/et_y; % Brazilian ethanol demand in tons of sugarcane;
D_W = S_W-DeBR; % World sugarcane sugar demand in tons of sugarcane;

% All quantities in relative world shares:
S_BR  = S_BR/S_W;
S_ROW = S_ROW/S_W;
DeBR  = DeBR/S_W;
D_W   = D_W/S_W;
dDUS  = dDUS/S_W;

%% Elasticities:
Elas_S_BR  = TableElas.Output;
Elas_S_ROW = [0.2, 0.2, TableElas.Output, TableElas.Output];
Elas_D_W   = [-0.01,-0.27, -0.01, -0.27];
Elas_DeBR  = -0.3;

%% Policy effect on prices:
dp_p = dDUS./(Elas_S_BR*S_BR+Elas_S_ROW.*S_ROW-Elas_D_W.*D_W-Elas_DeBR*DeBR);

dS_BR_p  = Elas_S_BR*S_BR*S_W*dp_p; % Increase in sugarcane from Brazil
dSA_BR_p = (TableElas.AcreageSweight/TableElas.Output)*dS_BR_p; % Increase in sugarcane from Brazil coming from acreage expansion in tonnes
dSA_BR_p = dSA_BR_p./y; % Increase in sugarcane from Brazil coming from acreage expansion in ha
dSA_BR_p = dSA_BR_p./kmsq2ha; % Increase in sugarcane from Brazil coming from acreage expansion in km^2
dYield_p = TableElas.YieldSweight*dp_p;
dSAnatural_BR_p = (TableExpansionDecomposition.ShareOfExpan(1)+TableExpansionDecomposition.ShareOfExpan(2))*dSA_BR_p;





